<%@ page language="java"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<%@ taglib uri="http://acegisecurity.org/authz" prefix="authz"%>
<%@ taglib tagdir="/WEB-INF/tags" prefix="mytags"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>

<table cellspacing="0" cellpadding="6" width="100%">
	<c:forEach items="${carList}" var="car" varStatus="status">
		<tr <c:if test="${status.index % 2 == 0}">class="gray"</c:if>>
			<td valign="middle" align="center"><c:url value="/viewCar.html"
				var="url">
				<c:param name="id" value="${car.id}" />
			</c:url> <authz:authorize ifAllGranted="ROLE_SUB_ADMIN">
				<c:url value="/private/carForm.html" var="url">
					<c:param name="id" value="${car.id}" />
				</c:url>
			</authz:authorize> <a href="${url}"><mytags:image id="${car.thumb.id}"
				cssClass="thumb" /></a></td>
			<td class="textAlignL paddingL">${car.make.name} ${car.model}</td>
			<td align="textAlignL paddingL">${car.year}</td>
			<td class="textAlignL paddingL">${car.location.name}</td>
			<td class="textAlignR paddingR"><c:choose>
				<c:when test="${not empty car.alternativeTextPrice}">
						${car.alternativeTextPrice}
					</c:when>
				<c:otherwise>
					<fmt:formatNumber value="${car.salesPrice}" pattern="#,##0" /> &euro;
					</c:otherwise>
			</c:choose></td>
		</tr>
	</c:forEach>
</table>
<p><pg:pager items="${count}" url="${pageUrl}"
	maxPageItems="${maxPageItems}" export="currentPageNumber=pageNumber">
	<pg:param name="id" />
	<pg:param name="model" />
	<pg:index>
		<pg:pages>
			<c:choose>
				<c:when test="${pageNumber == currentPageNumber}">
					<b>${pageNumber}</b>
				</c:when>
				<c:otherwise>
					<a href="${pageUrl}">${pageNumber}</a>
				</c:otherwise>
			</c:choose>
		</pg:pages>
	</pg:index>
</pg:pager>